//===============================================================================
// Microsoft Architecture Strategy Team
// LitwareHR - SaaS Sample Application
//===============================================================================
// Copyright  Microsoft Corporation.  All rights reserved.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE.
//===============================================================================
// The example companies, organizations, products, domain names,
// e-mail addresses, logos, people, places, and events depicted
// herein are fictitious.  No association with any real company,
// organization, product, domain name, email address, logo, person,
// places, or events is intended or should be inferred.
//===============================================================================


namespace Shp.Runtime.Contract
{
    using System;
    using System.Collections.Generic;
    using System.Runtime.Serialization;

    [DataContract, Serializable]
    public class EntityField
    {
        private Guid id;
        [DataMember]
        public Guid Id 
        {
            get
            {
                return id;
            }
            set
            {
                id = value;
            }
        }

        private string name;
        [DataMember]
        public string Name 
        {
            get
            {
                return name;
            }
            set
            {
                name = value;
            }
        }

        private Guid typeId;
        [DataMember]
        public Guid TypeId 
        {
            get
            {
                return typeId;
            }
            set
            {
                typeId = value;
            }
        }

        private string typeName;
        [DataMember]
        public string TypeName 
        {
            get
            {
                return typeName;
            }
            set
            {
                typeName = value;
            }
        }

        private bool isShared;
        [DataMember]
        public bool IsShared 
        {
            get
            {
                return isShared;
            }
            set
            {
                isShared = value;
            }
        }

        private bool isVisibleFromApplicationForm;
        [DataMember]
        public bool IsVisibleFromApplicationForm 
        {
            get
            {
                return isVisibleFromApplicationForm;
            }
            set
            {
                isVisibleFromApplicationForm = value;
            }
        }

        private string valueEntityField;
        [DataMember]
        public string Value 
        {
            get
            {
                return valueEntityField;
            }
            set
            {
                valueEntityField = value;
            }
        }


        static public EntityField[] Remove(string key, IList<EntityField> list)
        {
            List<EntityField> tmp = new List<EntityField>();
            foreach (EntityField field in list)
            {
                if (field.Name != key)
                {
                    tmp.Add(field);
                }
            }
            return tmp.ToArray();
        }
    }
}
